package com.oocl.euc.core.maintenance.repository;

import com.oocl.euc.core.maintenance.model.Role;
import com.oocl.euc.framework.base.persistence.IBaseRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RoleRepository extends IBaseRepository<Role, Long> {

    @Query(value = "SELECT DISTINCT R.* FROM PCRS_ROLE_AUTH RA INNER JOIN PCRS_ROLES R ON RA.ROLE_ID = R.ID WHERE RA.STAFF_ID = ?1", nativeQuery = true)
    List<Role> findRoleByStaffId(String staffId);

    List<Role> findRoleByRoleNameIn(List<String> roleName);
}
